<?php

/**
 * GameWeapon form base class.
 *
 * @method GameWeapon getObject() Returns the current form's model object
 *
 * @package    aiontoolskit
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGameWeaponForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'weapon_type'          => new sfWidgetFormChoice(array('choices' => array('1h_dagger' => '1h_dagger', '1h_mace' => '1h_mace', '1h_sword' => '1h_sword', '1h_toolhoe' => '1h_toolhoe', '2h_book' => '2h_book', '2h_orb' => '2h_orb', '2h_polearm' => '2h_polearm', '2h_staff' => '2h_staff', '2h_sword' => '2h_sword', '2h_toolpick' => '2h_toolpick', '2h_toolrod' => '2h_toolrod', 'bow' => 'bow'))),
      'item_type'            => new sfWidgetFormChoice(array('choices' => array('abyss' => 'abyss', 'devanion' => 'devanion', 'draconic' => 'draconic', 'normal' => 'normal'))),
      'dmg_decal'            => new sfWidgetFormInputText(),
      'icon_name'            => new sfWidgetFormInputText(),
      'equipment_slots'      => new sfWidgetFormChoice(array('choices' => array('main' => 'main', 'main_or_sub' => 'main_or_sub'))),
      'min_damage'           => new sfWidgetFormInputText(),
      'max_damage'           => new sfWidgetFormInputText(),
      'str'                  => new sfWidgetFormInputText(),
      'agi'                  => new sfWidgetFormInputText(),
      'kno'                  => new sfWidgetFormInputText(),
      'hit_accuracy'         => new sfWidgetFormInputText(),
      'critical'             => new sfWidgetFormInputText(),
      'parry'                => new sfWidgetFormInputText(),
      'magical_skill_boost'  => new sfWidgetFormInputText(),
      'magical_hit_accuracy' => new sfWidgetFormInputText(),
      'attack_type'          => new sfWidgetFormChoice(array('choices' => array('magical_fire' => 'magical_fire', 'magical_water' => 'magical_water', 'physical' => 'physical'))),
      'attack_delay'         => new sfWidgetFormInputText(),
      'hit_count'            => new sfWidgetFormInputText(),
      'attack_range'         => new sfWidgetFormInputText(),
      'quality_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'), 'add_empty' => false)),
      'level'                => new sfWidgetFormInputText(),
      'option_slot_bonus'    => new sfWidgetFormInputCheckbox(),
      'no_enchant'           => new sfWidgetFormInputCheckbox(),
      'bonus_attr1'          => new sfWidgetFormInputText(),
      'bonus_attr2'          => new sfWidgetFormInputText(),
      'bonus_attr3'          => new sfWidgetFormInputText(),
      'bonus_attr4'          => new sfWidgetFormInputText(),
      'bonus_attr5'          => new sfWidgetFormInputText(),
      'bonus_attr6'          => new sfWidgetFormInputText(),
      'bonus_attr7'          => new sfWidgetFormInputText(),
      'bonus_attr8'          => new sfWidgetFormInputText(),
      'bonus_attr9'          => new sfWidgetFormInputText(),
      'bonus_attr10'         => new sfWidgetFormInputText(),
      'bonus_attr11'         => new sfWidgetFormInputText(),
      'bonus_attr12'         => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'weapon_type'          => new sfValidatorChoice(array('choices' => array(0 => '1h_dagger', 1 => '1h_mace', 2 => '1h_sword', 3 => '1h_toolhoe', 4 => '2h_book', 5 => '2h_orb', 6 => '2h_polearm', 7 => '2h_staff', 8 => '2h_sword', 9 => '2h_toolpick', 10 => '2h_toolrod', 11 => 'bow'), 'required' => false)),
      'item_type'            => new sfValidatorChoice(array('choices' => array(0 => 'abyss', 1 => 'devanion', 2 => 'draconic', 3 => 'normal'), 'required' => false)),
      'dmg_decal'            => new sfValidatorInteger(array('required' => false)),
      'icon_name'            => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'equipment_slots'      => new sfValidatorChoice(array('choices' => array(0 => 'main', 1 => 'main_or_sub'), 'required' => false)),
      'min_damage'           => new sfValidatorInteger(array('required' => false)),
      'max_damage'           => new sfValidatorInteger(array('required' => false)),
      'str'                  => new sfValidatorInteger(array('required' => false)),
      'agi'                  => new sfValidatorInteger(array('required' => false)),
      'kno'                  => new sfValidatorInteger(array('required' => false)),
      'hit_accuracy'         => new sfValidatorInteger(array('required' => false)),
      'critical'             => new sfValidatorInteger(array('required' => false)),
      'parry'                => new sfValidatorInteger(array('required' => false)),
      'magical_skill_boost'  => new sfValidatorInteger(array('required' => false)),
      'magical_hit_accuracy' => new sfValidatorInteger(array('required' => false)),
      'attack_type'          => new sfValidatorChoice(array('choices' => array(0 => 'magical_fire', 1 => 'magical_water', 2 => 'physical'), 'required' => false)),
      'attack_delay'         => new sfValidatorInteger(array('required' => false)),
      'hit_count'            => new sfValidatorInteger(array('required' => false)),
      'attack_range'         => new sfValidatorNumber(array('required' => false)),
      'quality_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GameItemQuality'))),
      'level'                => new sfValidatorInteger(array('required' => false)),
      'option_slot_bonus'    => new sfValidatorBoolean(array('required' => false)),
      'no_enchant'           => new sfValidatorBoolean(array('required' => false)),
      'bonus_attr1'          => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'bonus_attr2'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr3'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr4'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr5'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr6'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr7'          => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'bonus_attr8'          => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr9'          => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr10'         => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr11'         => new sfValidatorString(array('max_length' => 22, 'required' => false)),
      'bonus_attr12'         => new sfValidatorString(array('max_length' => 31, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('game_weapon[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GameWeapon';
  }

}
